package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.ActivityRegisterDao;
import cn.topevery.garden.entity.dto.ActivityRegisterDTO;
import cn.topevery.garden.entity.po.ActivityRegister;
import cn.topevery.garden.entity.po.ActivityRegister;
import cn.topevery.garden.entity.query.ActivityRegisterQuery;
import cn.topevery.garden.entity.vo.ActivityRegisterVO;

import hw.topevery.framework.db.entity.DataPager;
import hw.topevery.framework.db.base.BaseEntityDao;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.web.JsonResult;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.UUID;

/**
 * 公园大型活动登记
 *
 * @author code-generate
 * @date 2022-10-28
 */
@Service
public class ActivityRegisterLogic extends BaseLogic<ActivityRegister> {
    @Autowired
    ActivityRegisterDao activityRegisterDao;

    @Override
    public BaseEntityDao<ActivityRegister, Integer> getDao() {
        return activityRegisterDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<ActivityRegisterVO> listPage(ActivityRegisterQuery query) {
        return activityRegisterDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        activityRegisterDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param activityRegister 实体
     */
    public void saveOrUpdate(String userId, ActivityRegister activityRegister){
        activityRegisterDao.saveOrUpdate(userId,activityRegister);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public ActivityRegister getEntityByColumn(String key, String value) {
        return activityRegisterDao.getEntityByColumn(key, value);
    }

    public JsonResult<?> countActivities(ActivityRegisterQuery query) {
        return JsonResult.ok(activityRegisterDao.countActivities(query));
    }
}
